/**
 * 
 */
package com.kingcore.pda.project.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.kingcore.framework.bean.impl.ResultSetWrapper;
import com.kingcore.pda.core.util.DbUtils;
import com.kingcore.pda.project.dao.ProjectDao;

/**
 * @author Zeven
 *
 */
public class ProjectDaoImpl implements ProjectDao{

	Logger log = Logger.getLogger( ProjectDaoImpl.class );
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

	public List queryProjectList() {
		List retList = null;

		// 执行数据库操作
		Connection conn = null;
		Statement stmt = null;
		ResultSet rs = null;
		String sql="";
		try {
			conn = DbUtils.getConnection();
			stmt = conn.createStatement();
			 
			// -------------------- 读取项目信息
			sql = "select id, projectCode,projectName,appcode,companyCode,companyName" +
					",dbType,dbName,poolName,tableCondition,expPath,templateCode,fileEncode" +
					",tableModuleNameOffset" +
					" from tb_pda_project Order By id desc"; // Order By id desc
			rs = stmt.executeQuery( sql );
			retList = new ResultSetWrapper(rs);
			for (Object object : retList) {
				Map map = (Map) object;
				log.debug("projectCode = "+map.get("projectcode")
						//+  " projectName = "+map.get("projectName") 
						//+  " fileEncode = "+map.get("fileEncode") 
						+  " tableModuleNameOffset = "+map.get("tableModuleNameOffset"));
				
			}
			return retList;

		}catch(Exception e){
			e.printStackTrace();

		} finally {
			wzw.util.DbUtils.closeQuietly(conn, stmt, rs);		
		}
		return retList;
	}

}
